package com.itheima.utils;

import org.apache.commons.beanutils.BeanUtils;

import javax.servlet.http.HttpServletRequest;
import java.util.Map;

/**
 * Create By Awen on 2021/8/12
 *
 * @author Awen
 */
public class CommonsUtils {
    public static <T> T beanPopulate(Class<T> clazz , HttpServletRequest request) throws Exception{
        T obj = clazz.newInstance();
        Map<String, String[]> map = request.getParameterMap();
        BeanUtils.populate(obj,map);
        return obj;
    }
}
